package cn.gcBlock.service;

import cn.gcBlock.po.Node;
import cn.gcBlock.dto.NewsQueryCriteria;
import cn.gcBlock.dto.NodeDTO;
import cn.gcBlock.dto.NodeQueryCriteria;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface BlockNodeService {

    //保存区块
    NodeDTO create(NodeDTO node);
    //获取余额
    double getRemainingSum(String publicKey);
    //查询账号是否存在
    boolean isExistBlock(String blockAddress,String symbol);

    boolean isPublicServer(String publicKey);
    //获取币子
    List<NodeDTO> findWallet(String publicKey);
    //获取币种
    List<String> findSymbols();
    //查找创世链
    NodeDTO findCreation(String symbol);
    //查询创生
    boolean isExistCreationBlock(String symbol);
    //注册
    NodeDTO registerBlockAddress(String symbol);

    List<NodeDTO> findAll();
    //签名
    NodeDTO sign( NodeDTO resource);
    /**
     * queryAll 分页
     * @param criteria
     * @param pageable
     * @return
     */
//@Cacheable(keyGenerator = "keyGenerator")
    Object queryAll(NodeQueryCriteria criteria, Pageable pageable);
    Object queryAll(NewsQueryCriteria criteria, Pageable pageable);

    /**
     * queryAll 不分页
     * @param criteria
     * @return
     */
//@Cacheable(keyGenerator = "keyGenerator")
    public Object queryAll(NodeQueryCriteria criteria);

    /**
     * findById
     * @param signature
     * @return
     */
//@Cacheable(key = "#p0")
    NodeDTO findById(String signature);
    NodeDTO findOneByCriteria(NodeQueryCriteria criteria);

    //@Cacheable(keyGenerator = "keyGenerator")
    public Page<Node> queryNodes(NodeQueryCriteria criteria, Pageable pageable);

}
